package com.gcxy.conf.exception.exception;


import com.gcxy.conf.exception.annotation.GlobalException;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author shinetan
 * @since 0.1.0
 */
@Slf4j
@GlobalException(priority = 0)
public class GlobalExceptionProcess implements IGlobalException<Object, Throwable> {

    @Override
    public Object exception(Throwable throwable, HttpServletRequest request, HttpServletResponse response) {
        log.error("UnKnown exception: url={}", request.getRequestURI(), throwable);
        return "{\"success\":false, \"code\":100500, \"msg\":\"系统异常\"}";
    }
}